#include <cstdlib>
#include "utils.h" 

uint32 int_pow (int base, int exponent)
{
	static int i;
	uint32 temp = 1;
	for (i=0; i<exponent; ++i)
	{
		temp *= base;
	}
	return temp;
}

double rand01 ()
{
	return rand()/ ((double) RAND_MAX + 1);
}

uint8 get_bit (uint64 bit_array, uint8 n)
{
	return (bit_array & (1<<n)) ? 1 : 0;
}

uint64 set_bit (uint64 bit_array, uint8 n, uint8 val)
{
	return val ? (bit_array | (1<<n)) : (bit_array & ~(1<<n));
}
